package entity

import (
	"shqsoft.cn/pasnj/base"

	"github.com/jinzhu/gorm"
)

//零售全年任务导入
type IndiQnrw struct {
	ID   int     `gorm:"AUTO_INCREMENT;primary_key;column:ID"`
	NF   int     `gorm:"column:NF"`   //年份
	CXRJ float64 `gorm:"column:CXRJ"` //储蓄日均
	ZJL  float64 `gorm:"column:ZJL"`  //资金量
	SD   float64 `gorm:"column:SD"`   //时点
	UTNM string  `gorm:"column:UTNM"` //网点
}

//TableName 零售全年任务导入
func (IndiQnrw) TableName() string {
	return "T_INDI_TB_QNRW"
}

//IndiLoanAfterImport 导入后执行分户处理
func IndiQnrwAfterImport(tx *gorm.DB, params map[string]string) (err error) {
	prams := make([]interface{}, 1)
	prams[0] = params["NF"]
	tx.Exec("EXEC UP_INDI_TB_QNRW ?", prams...)
	return nil
}

func IndiQnrwEF() base.EntityFunc {
	return func() interface{} {
		entity := IndiQnrw{}
		return &entity
	}
}
func IndiQnrwESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []IndiQnrw
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("IndiQnrw", base.NewDefaultDao(IndiQnrwEF(), IndiQnrwESF(), nil))
	base.SetAfterCallBack("IndiQnrw", IndiQnrwAfterImport)
}
